package com.wanghai.carwashing.common.helper;

import com.wanghai.carwashing.common.model.vo.SmsValidateCode;
import com.wanghai.carwashing.common.util.StringUtil;
import java.text.MessageFormat;

/**
 * SMS发送工具类
 * @author 王海
 */
public class SmsHelper {
    
    private static final String SMS_CODE_TEMPLATE = "您本次收到的验证码为:{0}(请在十分钟内完成验证)。【洗车APP】";
    /**
     * 短信发送地址
     */
    private static final String SMS_SEND_URL = "http://www.smsbao.com/sms?u={0}&p={1}&m={2}&c={3} ";
    
    private static final String u = "gyuwanghai";
    
    private static final String p = StringUtil.md5("gyu402009");
    /**
     * 发送短信验证码
     * @param code
     * @return 
     */
    public static HttpResult sendSmsValidateCode(SmsValidateCode code) throws Exception{
        return HttpHelper.get(MessageFormat.format(SMS_SEND_URL, u,p,code.getPhone(),
                MessageFormat.format(SMS_CODE_TEMPLATE, code.getCode())));
    }
}
